//
//  collectionHelpers.m
//  QuicklyPlay
//
//  Created by lanou3g on 15/11/9.
//  Copyright © 2015年 OPteam. All rights reserved.
//

#import "collectionHelpers.h"



static collectionHelpers* collectionH ;
@interface collectionHelpers ()

@property(nonatomic,strong) NSMutableArray *mutArray;

@end

@implementation collectionHelpers

+(instancetype)shareInstance {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        if (collectionH == nil) {
            collectionH = [[collectionHelpers alloc]init];
        }
    });
    return collectionH;
}

-(NSMutableArray*)mutArray{
    if (!_mutArray) {
        _mutArray = [NSKeyedUnarchiver unarchiveObjectWithFile:SelectedSortFile] ;
    }
    if (!_mutArray) {
        _mutArray = [NSMutableArray array];
    }
    return _mutArray;
}
-(NSArray*)array{
    
    return [self.mutArray copy];
}



-(void)celloction:(VideosModel*)model{
    
    if ([self.mutArray containsObject:model]) {
        return;
        //[self.mutArray removeObject:model];
    }
    [self.mutArray insertObject:model atIndex:0];
    
   [NSKeyedArchiver archiveRootObject:self.mutArray toFile:SelectedSortFile];

}




@end
